﻿using LuShanTea.Service.Entities;
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LuShanTea.Service.ModelConfig
{
    public class CommentConfig:EntityTypeConfiguration<Comment>
    {
        public CommentConfig()
        {
            this.ToTable("T_Comments");
            this.Property(e=>e.Content).HasMaxLength(256).IsRequired();
            this.Property(e=>e.CommentImgSrc).HasMaxLength(256);
            this.HasRequired(e => e.Good).WithMany().HasForeignKey(e => e.GoodId).WillCascadeOnDelete(false);
            this.HasRequired(e => e.User).WithMany().HasForeignKey(e => e.UserId).WillCascadeOnDelete(false);
            this.HasRequired(e => e.Order).WithMany().HasForeignKey(e => e.OrderId).WillCascadeOnDelete(false);
            
        }
    }
}
